﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Eassets.Service.Secure;
using Eassets.Layered.Domain.Secure;
using System.Collections.ObjectModel;

namespace Eassets.UI
{
    public partial class MainFram : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        private SecurityGroupUser AccessRight() 
        {
            SecurityGroupUserService securityGroupUserService = new SecurityGroupUserService();
            SecurityGroupUser securityGroupUser=new SecurityGroupUser();
            long securityGroupId=Convert.ToInt64(Session["SecurityGroupId"]);
            long userId=Convert.ToInt64(Session["LoggedUserId"]);
           securityGroupUser = securityGroupUserService.GetSecurityGroupUserforAccessRight(securityGroupId,userId);
           return securityGroupUser;
        }

        protected void buttoneGlobal_Click(object sender, EventArgs e)
        {
            Response.Redirect("GlobalReference/GlobalHomeForm.aspx");
        }

        protected void buttoneSecure_Click(object sender, EventArgs e)
        {
            Response.Redirect("Secure/ESecureHomeForm.aspx");
        }

        protected void buttoneAsset_Click(object sender, EventArgs e)
        {
            if (AccessRight() != null && AccessRight().SecurityGroupId==2)
            {
                LabelAccess.Visible = true;

            }
            else { 
             Response.Redirect("Asset/EassetHomeForm.aspx");
            }
           
        }

    }
}